using System;
using System.Collections.Generic;
using System.Text;
using Impact.Model.Objects;

namespace Impact.Model.Service
{
    /// <summary>
    /// defines the functions available from the service providing article data
    /// </summary>
    public interface IArticleService
    {

        /// <summary>
        /// Retrieve the article object that belongs to the given ID
        /// </summary>
        Article FetchByID(int articleId);

        /// <summary>
        /// Retrieve any articles that contain the given terms in their title or bodies
        /// </summary>
        ArticleCollection FetchByTerms(string terms);

        /// <summary>
        /// Retrieve all articles in the given category
        /// </summary>
        /// <param name="categoryId">ID of the category to retrieve</param>
        /// <param name="onlyEnabled">true to return only categories that are enabled.  false to return all categories.</param>
        ArticleCollection FetchByCategory(int categoryId, bool onlyEnabled);

        /// <summary>
        /// Retrieve all articles in the given category
        /// </summary>
        /// <param name="categoryKey">string key of the category to retrieve</param>
        /// <param name="onlyEnabled">true to return only categories that are enabled.  false to return all categories.</param>
        ArticleCollection FetchByCategory(string categoryKey, bool onlyEnabled);

        /// <summary>
        /// Retrieve all comments for the given article
        /// </summary>
        ArticleCommentCollection FetchComments(int ArticleId);

        /// <summary>
        /// Retrieve all tags for the given article
        /// </summary>
        ArticleTagCollection FetchTags(int articleId);

        /// <summary>
        /// Commits the given article to the datastore
        /// </summary>
        void Save(Article article);

        /// <summary>
        /// Commits the given article to the datastore
        /// </summary>
        void Save(Article article, Guid guid);

        /// <summary>
        /// store the given comment attributing it to the given userID
        /// </summary>
        void SaveComment(ArticleComment comment, string userId);

        /// <summary>
        /// Adds the given tag to the given article
        /// </summary>
        /// <param name="articleId">ID of the article to attach the tag to</param>
        /// <param name="tagId">ID of the tag to attach</param>
        /// <param name="guid">ID of the user attaching the tag</param>
        void AddTag(int articleId, int tagId, Guid guid);

        /// <summary>
        /// Removes the given article from the datastore
        /// </summary>
        void Remove(int articleId);

        /// <summary>
        /// Remove the given comment from it's article
        /// </summary>
        void RemoveComment(int commentId);

        /// <summary>
        /// Removes the given article-tag relationship
        /// </summary>
        void RemoveTag(int articleTagId);

        /// <summary>
        /// Removes all tags from the given article
        /// </summary>
        void RemoveAllTags(int articleId);

        /// <summary>
        /// Retrieve all articles
        /// </summary>
        /// <param name="onlyEnabled">retrieve only enabled articles</param>
        /// <returns></returns>
        ArticleCollection FetchAll( bool onlyEnabled );
    }
}
